package com.tm.hutool.entity;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

/**
 * @author zyl
 * @create 2022-08-17 14:38
 */
public class Main {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        //获取class对象的三种方式
        //对象名.getClass();
        Student student = new Student();
        Class<? extends Student> aClass = student.getClass();
        //类名.class
        Class<Student> studentClass = Student.class;
        //Class.forName("类的全限定名")
        Class<?> aClass1 = Class.forName("com.tm.hutool.entity.Student");
        System.out.println(aClass1 ==studentClass);

        Constructor<?>[] constructors = studentClass.getConstructors();
        Arrays.stream(constructors).forEach(System.out::println);
        System.out.println("---------------------------123");
        Constructor<?>[] declaredConstructors = studentClass.getDeclaredConstructors();
        Arrays.stream(declaredConstructors).forEach(System.out::println);

        
//        Constructor<Student> constructor = studentClass.getConstructor();
//        Student student1 = constructor.newInstance();

    }
}
